<?php
class UserMenuPortlet extends RightSidePortlet{
	public $title="Profile";
	protected function renderContent(){
		$app=Yii::app();
		$user=$app->user;
		echo '<p>'.CHtml::link('View My Profile',array('/user/user/profile'))
		.'<br />'
		.CHtml::link('Edit My Profile',array('/user/user/edit'))
		.'</p>';
		if($user->checkAccess("cafeOwner")){
			echo '<p>';
			//$cafes=CoffeeShop::model()->findAllByAttributes(array('ownerId'=>$user->getId()));
//			foreach ($cafes as $cafe){
//				echo CHtml::link($cafe->name,array('/coffeeShop/manageImages','id'=>$cafe->id)).' ';
//			
//			}
			echo CHtml::link('Manage My Cafe',array('/subscribe/cafeOwner')).' ';
				
			
			echo '</p>';
		}
		if($user->checkAccess("applyAdmin")){
			echo '<p>Application Manage: ';
			echo CHtml::link("Approve Owner",array('/coffeeApply/admin')).', ';
			echo CHtml::link("Approve Recommend",array('/coffeeRecommend/admin')).', ';
			echo '</p>';
		}
		if($user->checkAccess("cafeAdmin")){
			echo '<p>Cafe Manage: ';
			echo CHtml::link("Manage Cafe",array('/coffeeShop/admin')).', ';
			echo CHtml::link("Create Cafe",array('/coffeeShop/create')).', ';
			echo CHtml::link("Create User",array('/coffeeShop/quickCreateUser')).', ';
			echo '</p>';
		}
		if($user->checkAccess("admin")){
			echo '<p>Admin Manage: ';
			echo CHtml::link("Manage Users",array('/user/user/admin')).', ';
			echo CHtml::link("Global Config",array('/globalConfig/admin')).', ';
			echo CHtml::link("Manage Articles",array('/article/admin')).', ';
			echo CHtml::link("Export Cafe",array('/coffeeShop/exportFile')).', ';
			echo CHtml::link("Manage Subscriptions",array('/cafeOwnerSubscribe/admin')).', ';
			echo CHtml::link("Create Subscriptions",array('/cafeOwnerSubscribe/create')).', ';
			echo '</p>';
		}
	}
}